//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CommunityServer.Components;
using CommunityServer.Controls;
using CommunityServer.Discussions.Components;

namespace CommunityServer.Discussions.Controls {

	// *********************************************************************
	//  AggregateDiscussionRepeater
	//
	/// <summary>
	/// Used to display an aggregate list of discussions.
	/// </summary>
	/// 
	// ********************************************************************/
	public class AggregateDiscussionRepeater : Repeater {

		#region Member variables and constructor
		CSContext csContext = CSContext.Current;
		#endregion


		protected override void CreateChildControls() {

            ForumThreadQuery query = new ForumThreadQuery();
            query.ForumID = -1;
            query.PageSize = 25;
            query.ThreadsNewerThan = DateTime.Now.AddYears(-24);

			ThreadSet threadSet = Threads.GetThreads(query);

			// Do we have posts to display?
			//
			if (threadSet.Threads.Count > 0) {
				DataSource = threadSet.Threads;
				DataBind();
			} 
		}

		int sectionID = -1;
		public int SectionID {
			get { return sectionID; }
			set { sectionID = value; }
		}

		int pageSize = 10;
		public int PageSize {
			get { return pageSize; }
			set { pageSize = value; }
		}
	}

}
